//
//  NSTimer+QTAdd.m
//  Pods
//
//  Created by 张俊博 on 16/8/22.
//
//

#import "NSTimer+QTAdd.h"
#import "QTCategoryMacro.h"

QTSYNTH_DUMMY_CLASS(NSTimer_QTAdd)

@implementation NSTimer (QTAdd)

+ (void)_qt_ExecBlock:(NSTimer *)timer {
    if ([timer userInfo]) {
        void (^block)(NSTimer *timer) = (void (^)(NSTimer *timer))[timer userInfo];
        block(timer);
    }
}

+ (NSTimer *)scheduledTimerWithTimeInterval:(NSTimeInterval)seconds block:(void (^)(NSTimer *timer))block repeats:(BOOL)repeats {
    return [NSTimer scheduledTimerWithTimeInterval:seconds target:self selector:@selector(_qt_ExecBlock:) userInfo:[block copy] repeats:repeats];
}

+ (NSTimer *)timerWithTimeInterval:(NSTimeInterval)seconds block:(void (^)(NSTimer *timer))block repeats:(BOOL)repeats {
    return [NSTimer timerWithTimeInterval:seconds target:self selector:@selector(_qt_ExecBlock:) userInfo:[block copy] repeats:repeats];
}

@end
